var _n70;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var cc_uiService = require("uiService");
var zqcc_uiService = cc__importDefault(cc_uiService);
var cc_OverallSystem = require("zqcc_OverallSystem");
var cc_cc__decorator = cc._decorator;
var cc_ccp_ccclass = cc_cc__decorator.ccclass;
var cc_ccp_property = cc_cc__decorator.property;
var def_pageBase = function (t) {
  function _ctor() {
    // 初始化变量，确保 t 存在则调用它，否则返回当前上下文
    var instance = null !== t && t.apply(this, arguments) || this;

    // 设置对象的基本属性
    instance.pageName = "页面基础组件"; // 页面名称
    instance.id = -1;                     // ID 初始化为 -1
    instance.showNode = null;              // 显示节点初始化为 null
    instance.closeCallback = null;         // 关闭回调函数初始化为 null

    // 返回创建的对象
    return instance;

  }
  cc__extends(_ctor, t);
  _ctor.prototype.zqcc_setCloseDoFun = function (t) {
    this.colseDoFun = t;
  };
  _ctor.prototype.start = function () {
    this.zqcc__init();
  };
  _ctor.prototype.zqcc__init = function () {
    this.open();
  };
  _ctor.prototype.initData = function () { };
  _ctor.prototype.open = function () {
    zqcc_uiService.default.openPageBasicAni(this.showNode, true).then(function () { }).catch(function () { });
  };
  _ctor.prototype.close = function () {
    var instance = this; // 保存当前上下文

    // 执行关闭动画
    this.zqcc_closeAni().then(function () {
      // 调用关闭回调函数（如果存在）
      if (instance.closeDoFun) {
        instance.closeDoFun();
      }

      // 删除页面记录
      cc_OverallSystem.sers().uiSrv.deletePageRecord(instance.id);

      // 销毁当前节点
      instance.node.destroy();
      console.log("组件已关闭"); // 输出关闭日志
    }).catch(function (error) {
      console.warn("关闭动画失败:", error); // 捕获并记录错误
    });
  };
  _ctor.prototype.onlyClose = function () {
    var instance = this; // 保存当前上下文

    // 执行关闭动画
    this.zqcc_closeAni().then(function () {
      // 删除页面记录
      cc_OverallSystem.sers().uiSrv.deletePageRecord(instance.id);

      // 销毁当前节点
      instance.node.destroy();
    }).catch(function (error) {
      console.warn("关闭动画失败:", error); // 捕获并输出错误信息
    });

  };
  _ctor.prototype.OnBtnClose = function () {
    cc_OverallSystem.mgrs().soundMgr.playBtnSound();
    this.close();
    console.log("OnBtnClose");
  };
  _ctor.prototype.zqcc_closeAni = function (t) {
    undefined === t && (t = false);
    return zqcc_uiService.default.closePageBasicAni(this.showNode, t);
  };
  _ctor.prototype.update = function () { };
  cc__decorate([cc_ccp_property({
    type: cc.Node,
    displayName: "需要展示的节点"
  })], _ctor.prototype, "showNode", undefined);
  return cc__decorate([cc_ccp_ccclass], _ctor);
}(cc.Component);
exports.default = def_pageBase;